//
//  MQAdDetailViewController.m
//  meiquan
//
//  Created by hejingjin on 2017/11/4.
//  Copyright © 2017年 mq. All rights reserved.
//

#import "MQAdDetailViewController.h"
#import "MQBaseUserInfoModel.h"

@interface MQAdDetailViewController ()

@property(nonatomic,strong)UIWebView *adinfowebview;


@end

@implementation MQAdDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"详情";
    
    [self setUpMainInterface];
    if ([_type isEqualToString:@"app"]) {
        [self getdataFromSever];
    }
 
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)setUpMainInterface{
    self.view.backgroundColor = BSTColorFromRGB(0xefefef);
    
    _adinfowebview = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, BSTScreenW, BSTScreenH)];
    _adinfowebview.backgroundColor = [UIColor whiteColor];
    _adinfowebview.opaque = NO;
    if ([_type isEqualToString:@"html"]) {
        [_adinfowebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:_url]]];
    }
    [self.view addSubview:_adinfowebview];
}

-(void)getdataFromSever{
    
//    NSMutableDictionary *dic = []
    
 
    [MQRequestTools GETUPWithMethods:_url params:nil success:^(id json) {
        
        [_adinfowebview loadHTMLString:[json valueForKey:@"data"] baseURL:nil];
        
    } failure:^(NSError *error) {
        
    }];
    
    
}



@end
